import http from "./requirest"


// 产品部分----------------------------------------------------------------------------------------------------------------------------------


declare global{
    interface productParam{
        product_id?:string
        cateory_id?:string
    }
}
export const getProduct = (params:productParam) => http.get('/product/get_product',{
    params
})

interface addProductParam{
    category_id:string
    productName:string
    price:string
    description:string
    inventory:string
    imageUrl:string
}
export const addProduct = (addProductParam:addProductParam) => 
    http.post('/product/add_product', {addProductParam})


//产品类目部分--------------------------------------------------------------------------------------------------------------------------------

export const getCategory = () => http.get('/category/getCategory')


export const addCategory = (categoryName:string,categoryImgurl?:string) => http.post('/category/addCategory',{categoryName,categoryImgurl})

export const delCategory = (category_id: string[]) => http.get('/category/delCategory',{params:{category_id}})

export const updateCategory = (categoryName:string,category_id:string) => http.post('/category/updateCategory',{categoryName,category_id})


// export const uploadCategoryImg = (headimgurl:string) => http.post('/students/uploadStuAvatar',{headimgurl})